<template>
  <el-badge :value="size">
    <el-button
      style="margin-left: 20px;"
      @click="this.$router.push({ path: '/shoppingCart'})"
    >
      <el-icon style="margin: 4px;">
        <ShoppingCart />
      </el-icon>
      我的购物车
    </el-button>
  </el-badge>
</template>

<script>
import { selectShoppingCartSize } from "@/api/shoppingCart";

export default {
  data() {
    return {
      size: 0,
    };
  },
  methods: {
    doSelectShoppingCartSize() {
      selectShoppingCartSize().then((res) => {
        this.size = res;
      });
    },
  },
  created() {
    this.doSelectShoppingCartSize();
  },
};
</script>